import * as Blockly from 'blockly/core';
import { Profile } from 'mixly';
import Variables from './others/variables';
import Procedures from './others/procedures';
import { C } from './generators/c_generator';
import pins from './pins/pins';

import * as CommonTextBlocks from 'mixly2/boards/default_src/arduino_common/blocks/text';

import * as AvrControlBlocks from './blocks/control';
import * as AvrFactoryBlocks from './blocks/factory';
import * as AvrInoutBlocks from './blocks/inout';
import * as AvrListsBlocks from './blocks/lists';
import * as AvrLogicBlocks from './blocks/logic';
import * as AvrMathBlocks from './blocks/math';
import * as AvrPinsBlocks from './blocks/pins';
import * as AvrProceduresBlocks from './blocks/procedures';
import * as AvrSerialBlocks from './blocks/serial';
import * as AvrTextBlocks from './blocks/text';
import * as AvrVariablesBlocks from './blocks/variables';

import * as CommonTextGenerators from 'mixly2/boards/default_src/arduino_common/generators/text';

import * as AvrControlGenerators from './generators/control';
import * as AvrFactoryGenerators from './generators/factory';
import * as AvrInoutGenerators from './generators/inout';
import * as AvrListsGenerators from './generators/lists';
import * as AvrLogicGenerators from './generators/logic';
import * as AvrMathGenerators from './generators/math';
import * as AvrPinsGenerators from './generators/pins';
import * as AvrProceduresGenerators from './generators/procedures';
import * as AvrSerialGenerators from './generators/serial';
import * as AvrTextGenerators from './generators/text';
import * as AvrVariablesGenerators from './generators/variables';

import './css/color.css';

Blockly.Arduino = C;

Object.assign(Blockly.Variables, Variables);
Object.assign(Blockly.Procedures, Procedures);
Profile.default = {};
Object.assign(Profile, pins);
Object.assign(Profile.default, pins.arduino_standard);

Object.assign(
    Blockly.Blocks,
    CommonTextBlocks,
    AvrControlBlocks,
    AvrFactoryBlocks,
    AvrInoutBlocks,
    AvrListsBlocks,
    AvrLogicBlocks,
    AvrMathBlocks,
    AvrPinsBlocks,
    AvrProceduresBlocks,
    AvrSerialBlocks,
    AvrTextBlocks,
    AvrVariablesBlocks
);

Object.assign(
    Blockly.Arduino.forBlock,
    CommonTextGenerators,
    AvrControlGenerators,
    AvrFactoryGenerators,
    AvrInoutGenerators,
    AvrListsGenerators,
    AvrLogicGenerators,
    AvrMathGenerators,
    AvrPinsGenerators,
    AvrProceduresGenerators,
    AvrSerialGenerators,
    AvrTextGenerators,
    AvrVariablesGenerators
);